package cn.kattomy.shop.prevcategory.dao.impl;

import java.util.List;

import cn.kattomy.shop.base.dao.BaseDao;
import cn.kattomy.shop.categorysecond.vo.CategorySecond;
import cn.kattomy.shop.prevcategory.dao.PrevCategoryDao;
import cn.kattomy.shop.prevcategory.vo.PrevCategory;

public class PrevCategoryDaoImpl extends BaseDao implements PrevCategoryDao {

	@Override
	public List<PrevCategory> findAll() {
		String hql = "FROM PrevCategory order by pcid";
		List<PrevCategory> prevList = getSession().createQuery(hql).setFirstResult(0).setMaxResults(13).list();
		return prevList;
	}

	@Override
	public PrevCategory findByPcid(Integer pcid) {
		return (PrevCategory) getSession().get(PrevCategory.class, pcid);
	}

	@Override
	public void delete(PrevCategory prevCategory) {
		getSession().delete(prevCategory);
	}

	@Override
	public void save(PrevCategory prevCategory) {
		getSession().save(prevCategory);
	}

	@Override
	public void update(PrevCategory prevCategory) {
		getSession().saveOrUpdate(prevCategory);
	}
	
}
